package com.insideClass.event;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 13699
 */
public class Controller {
    private List<Event> eventlist=new ArrayList<>();
    public void addEvent(Event c){
        eventlist.add(c);
    }
    public void run(){
        while (eventlist.size()>0) {
            for (Event e : new ArrayList<>(eventlist)) {
                    if(e.ready()){
                        System.out.println(e);
                        e.action();
                        eventlist.remove(e);
                    }
            }
        }
    }
}
